<?php
/*
 * name: cxm
 * desc: 系统设置 迁移表
 * date: 2019/01/11
 * */
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class CreateSystemConfigTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('system_config', function (Blueprint $table) {
            $table->increments('id');
            $table->char('code',36)->comment('主键 唯一标识');
            $table->string('name',255)->comment('显示名称');
            $table->text('val')->nullable()->comment('键值');
            $table->string('group_code',30)->comment('分组码');
            $table->string('show_type',50)->comment('显示类型');
            $table->text('default_vals')->nullable()->comment('默认值');
            $table->text('default_names')->nullable()->comment('默认值名称');
            $table->tinyInteger('is_show')->comment('是否显示');
            $table->integer('sort')->default(0)->comment('排序');
            $table->string('tooltip',150)->comment('提示');
            $table->timestamps();
        });
        // 表注释
        DB::statement("ALTER TABLE `".config('database.connections.mysql.prefix')."system_config` comment'系统设置'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('system_config');
    }
}
